package com.suibibk.springCloud.order;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService{

    @Override
    @SentinelResource(value = "getUser", blockHandler = "exceptionHandler")
    public String getUser() {
        return "返回用户";
    }
    //自定义返回
    public String exceptionHandler(BlockException ex) {
        // Do some log here.
        ex.printStackTrace();
        return "被限流了";
    }
}
